import request from '@/utils/request_miva_work.js';

export function ossSTS() {
  return request({
    url: '/getSTS',
    method: 'GET'
  });
}

export function saveResource({ name, url, size, suffix, mime, sha256 }) {
  return request({
    url: '/resource',
    method: 'POST',
    data: { name, url, size, suffix, mime, sha256 }
  });
}

export function listResource({ page = 1, size = 20 }) {
  return request({
    url: '/resource',
    method: 'GET',
    params: { page, size }
  });
}

export function renameResource({ id, name }) {
  return request({
    url: '/resource/' + id,
    method: 'PUT',
    data: { name }
  });
}

export function deleteResource({ id }) {
  return request({
    url: '/resource/' + id,
    method: 'DELETE'
  });
}
